﻿using Camc.Quality.RecordTable.FormBase;
using Camc.Quality.RecordTable.FormClass;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Camc.Quality.RecordTable.FormEntity
{
    public class 通用总装数据记录表 : TableBase
    {
        public 通用总装数据记录表(int serialNum, Guid workStepEntityId, Guid processesEntityId, int sort, string firstDrawingName, string recordElement, string toolUsed)
        {
            SerialNum = serialNum;
            Sort = sort;
            WorkStepEntityId = workStepEntityId;
            ProcessesEntityId = processesEntityId;

            FirstDrawingName = firstDrawingName;
            RecordElement = recordElement;
            ToolUsed = toolUsed;

        }
        public override string FormName { get; protected set; } = "通用总装数据记录表";

        public override string FirstDrawingName_DisplayName { get; protected set; } = "名称";
        public override bool FirstDrawingName_Show { get; protected set; } = true;

        public override string RecordElement_DisplayName { get; protected set; } = "项目";
        public override bool RecordElement_Show { get; protected set; } = true;
        public override int RecordElement_Property { get; protected set; } = 1;

        public override string ToolUsed_DisplayName { get; protected set; } = "所用工具编号";
        public override bool ToolUsed_Show { get; protected set; } = true;
        public override bool ToolUsed_Enable { get; protected set; } = true;

        public RecordRequirementsEntity SetRecordRequirements(RecordRequirementsEntity entity, string designerDemand, string processorDemand, string remark)
        {
            entity.SetDesignerDemand(designerDemand, "设计要求", false, true, 0);
            entity.SetProcessorDemand(processorDemand, "工艺要求", false, true, 0);
            entity.SetRemarks(remark, "备注", false, true, 0);
            return entity;
        }
        public MeasuredResultEntity SetMeasuredResult(MeasuredResultEntity entity, string measuredValues)
        {
            entity.SetFirstMeasuredValues(measuredValues, "实测值", true, true, 0);
            return entity;
        }
        /// <summary>
        /// 插入环境要素
        /// </summary>
        public EnvironmentEntity SetEnvironment(EnvironmentEntity entity, string temperature, string humidity)
        {
            entity.SetTemperature(temperature, "温度", true, true, 2);
            entity.SetHumidity(humidity, "湿度", true, true, 2);
            return entity;
        }

        public InspectionSignatureEntity SetInspectionSignature(InspectionSignatureEntity entity)
        {
            entity.InspectionSignatureName = "三检";
            entity.SetFirstOperator(null, "操作者", true, true, 0, null, "操作者操作时间", true, true, 0);
            entity.SetSecondOperator(null, "互检者", true, true, 0, null, "互检者操作时间", true, true, 0);
            entity.SetThirdOperator(null, "检验员", true, true, 0, null, "检验员操作时间", true, true, 0);
            return entity;
        }
    }
}
